#括号匹配
def kuo(s):
    list = []
    for i in s:
        if list == []:
            list.append(i)
        elif list[len(list)-1] == '(' and i == ')':
            list.pop()
        elif list[len(list)-1] == '[' and i == ']':
            list.pop()
        elif list[len(list)-1] == '{' and i == '}':
            list.pop()
        else:
            list.append(i)
    if list == []:
        return True
    return False
print(kuo("()({})"))
print(kuo("({[[})"))